<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">  
  <title>基本设置 - {:cms('title')}</title>
{include file="app/template/pc/default_pc/home_header.html"}
<div class="layui-body" style="padding: 20px;">
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
  <ul class="layui-tab-title">
    <li class="layui-this">基本设置</li>
    <li>密码修改</li>
	{:h('setabc')}
  </ul>
  <div class="layui-tab-content">
    <div class="layui-tab-item layui-show">
<!---->
<form class="layui-form layui-form-pane" action="">
  <div class="layui-form-item">
    <label class="layui-form-label">邮箱</label>
    <div class="layui-input-inline">
      <input type="text" name="usermail" required="" lay-verify="required" autocomplete="off" value="{:member('usermail')}" class="layui-input" {if condition="cms('homemail') eq '0'"}disabled{/if} >
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">手机号码</label>
    <div class="layui-input-inline">
      <input type="text" autocomplete="off" value="{:member('phone')}" class="layui-input" disabled>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">用户名</label>
    <div class="layui-input-inline">
      <input type="text" name="username" required lay-verify="required|names"  value="{:member('username')}" placeholder="请输入用户名" autocomplete="off" class="layui-input">
    </div>
  </div>
  
  <div class="layui-form-item">
    <label class="layui-form-label">QQ</label>
    <div class="layui-input-inline">
      <input type="text" name="userqq" required lay-verify="required"  value="{:member('userqq')}" placeholder="请输入用户名" autocomplete="off" class="layui-input">
    </div>
  </div>
  
  <div class="layui-form-item">
    <label class="layui-form-label">网址</label>
    <div class="layui-input-inline">
      <input type="text" name="url"  value="{:member('url')}" placeholder="请输入网址" autocomplete="off" class="layui-input">
    </div>
  </div>
  
  <div class="layui-form-item">
    <label class="layui-form-label">地区</label>
    <div class="layui-input-inline">
      <input type="text" name="userhome" required lay-verify="homes" value="{:member('userhome')}" placeholder="请输入地区" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">性别</label>
    <div class="layui-input-block">
      <input type="radio" name="sex" value="1" title="男" {if condition="member('sex') eq '1'"}checked{/if}>
      <input type="radio" name="sex" value="0" title="女" {if condition="member('sex') eq '0'"}checked{/if}>
    </div>
  </div>
  
  <div class="layui-form-item">
    <label class="layui-form-label">头像</label>
    <div class="layui-input-inline">
      <input type="text" name="userhead" id="upsimg" required lay-verify="required" value="{:member('userhead')}" placeholder="请输入地区" autocomplete="off" class="layui-input">
      <div id="tup" style="display:none;"><img id="tupimg" src="/public/img/touxiang.jpg" width="190"> </div>
    </div>
    <div class="layui-word-aux">
    	<button type="button" class="layui-btn" id="upimg"> <i class="layui-icon">&#xe67c;</i>上传头像</button>
    </div>
  </div>
  
  
  <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">个人介绍</label>
    <div class="layui-input-block">
      <textarea name="description" placeholder="请输入内容" lay-verify="descrs" class="layui-textarea">{:member('description')}</textarea>
    </div>
  </div>
  <div class="layui-form-item">
      <button class="layui-btn" lay-submit lay-filter="home">提交修改</button>
  </div>
</form>
<!---->
</div>
    <div class="layui-tab-item">
    	
   <form class="layui-form layui-form-pane" action="">
			  <div class="layui-form-item">
                <label class="layui-form-label">修改密码</label>
                <div class="layui-input-inline">
                  <input type="password" name="password" required lay-verify="required|pass" autocomplete="off" class="layui-input">
                </div>
              </div>

              <div class="layui-form-item">
                <label class="layui-form-label">确认密码</label>
                <div class="layui-input-inline">
                  <input type="password" name="passwords" required lay-verify="required|pass" autocomplete="off" class="layui-input">
                </div>
              </div>

              <div class="layui-form-item">
                <button class="layui-btn" lay-submit="" lay-filter="homemima">确认修改</button>
              </div>

            </form>
    	</div>
  </div>
</div>
<script>
     layui.use('upload', function(){
     	var $ = layui.jquery
     	,upload = layui.upload;
     	jq = layui.jquery;
		upload.render({
			elem: '#upimg',
			url: "{:url("up/up")}",
			accept: 'file',
			size: 50,
			accept: 'images',
			done: function(res) {
				if (res.code == '200') {
					jq('input[id=upsimg').val(res.path);
					return layer.msg(res.msg);
				} else {
					return layer.msg(res.msg);
				}
			}
		});
       });
</script>
<script>
layui.use(['element','form'],function(){
  var form = layui.form
  ,jq = layui.jquery;
  form.on('submit(home)', function(data){
    loading = layer.load(2, {
      shade: [0.2,'#000']
    });
    var param = data.field;
    jq.post('{:url("api/api/homeset")}',param,function(data){
      if(data.code == 200){
        layer.close(loading);
        layer.msg(data.msg, {icon: 1, time: 1000}, function(){
          //location.href = '{:url("index/index")}';
        });
      }else{
        layer.close(loading);
        layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
      }
    });
    return false;
  });
  form.on('submit(homemima)', function(data){
    loading = layer.load(2, {
      shade: [0.2,'#000']
    });
    var param = data.field;
    jq.post('{:url("api/api/homepass")}',param,function(data){
      if(data.code == 200){
        layer.close(loading);
        layer.msg(data.msg, {icon: 1, time: 1000}, function(){
          //location.href = '{:url("index/index")}';
        });
      }else{
        layer.close(loading);
        layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
      }
    });
    return false;
  });
  form.verify({
    names: function(value){
      if(value.length > 12){
        return '昵称必须小于12位';
      }
    }
	,homes: function(value){
      if(value.length > 6){
        return '城市必须小于6位';
      }
    }
	,descrs: function(value){
      if(value.length > 16){
        return '签名必须小于16位';
      }
    }
    ,pass: [/(.+){6,12}$/, '密码必须6到12位']
    ,content: function(value){
      layedit.sync(editIndex);
    }
  });
})
</script>
<script>
$(document).ready(function(){
  $("#upsimg").mouseenter(function(){
  	//鼠标移上显示
  	$("#tup").css({"display":"block"});
  	//获取upsimg值
    OR=  $("#upsimg").val();
    //传入tupimg
    $("#tupimg").attr("src",OR);
  });
 $("#upsimg").mouseleave(function(){
 	//鼠标离开隐藏
 	$("#tup").css({"display":"none"});
    
  });
});
</script>
</div>
<!--系统预留插件钩子请保设置页面-->
{:h('homesetpc')}
{include file="app/template/pc/default_pc/home_footer.html"}